package ird.demo.service.impl;

import ird.demo.domain.Menu;
import ird.demo.repository.MenuRepository;
import ird.demo.service.MenuService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.google.inject.internal.Lists;

@Service
public class MenuServiceImpl implements MenuService{

	@Autowired
	private MenuRepository menuRepository;


	public Menu findMenuById(String pk){
		return menuRepository.findOne(pk);
	}
	
	public List<Menu> findAllMenu(){
		return Lists.newArrayList(menuRepository.findAllMenu());
	}
	
	public Menu findMenuByTranId(String tranId){
		return menuRepository.findMenuByTranId(tranId);
	}
	
	public void updateMenu(Menu menu){
		Menu updatedMenu = menuRepository.save(menu);
		System.out.println("updatedMenu="+updatedMenu);
	}

}
